import { Agv } from "@/api/interface/agv";
import { PORT1 } from "@/api/config/servicePort";
import http from "@/api";

/**
 * @name 车辆管理接口
 */

// 查询全部车辆
export const getProductPageAll = (params: Agv.ReqAgv) => {
  return http.post<Agv.ResAgvData>(PORT1 + `/product/all`, params);
};

// 分页查询全部车辆
export const getProductPage = (params: Agv.ReqAgv) => {
  return http.post<Agv.ResAgvData>(PORT1 + `/product/page`, params);
};

// 添加车辆
export const addProductAdd = (params: Agv.ResAgvData) => {
  return http.post(PORT1 + `/product/add`, params);
};

// 修改车辆
export const updateProductUpdate = (params: Agv.ResAgvData) => {
  return http.post(PORT1 + `/product/update`, params);
};

// 删除车辆
export const delProductDelete = (params: Agv.ReqAgv) => {
  return http.get(PORT1 + `/product/delete`, params);
};

// 查询车辆
export const getProductList = () => {
  return http.get<Agv.ResAgvData>(PORT1 + `/product/list`);
};

// 查询详情
export const getProductDetail = (params: Agv.ResAgvData) => {
  return http.get(PORT1 + `/product/detail`, params);
};

// 查询未绑定项目的车辆
export const getListProductUnbound = () => {
  return http.get<Agv.ResAgvData>(PORT1 + `/product/listProductUnbound`);
};

// 设备锁车
export const getFmsProductLock = (params: Agv.ReqAgv) => {
  return http.get(PORT1 + `/fms/product/lock`, params);
};

// 升级

export const upgradeFmsOta = (params: Agv.ResAgvData) => {
  return http.post(PORT1 + `/fms/ota/upgrade`, params);
};

// 升级进度
export const getFmsOtaProgress = (params: Agv.ResAgvData) => {
  return http.get(PORT1 + `/fms/ota/upgrade/progress`, params, { noLoading: true });
};
